package com.only.common.util.ssh;

import lombok.Data;

/**
 * @author only
 * @date 2023/12/18
 * @description
 */
@Data
public class PortCheckResult {
    /**
     * 执行是否成功
     */
    private boolean isSuccess;

    /**
     * 端口是否被占用
     */
    private boolean portOccupied;

    /**
     * 错误信息
     */
    private String errMessage;

    public PortCheckResult(boolean isSuccess, boolean portOccupied, String errMessage) {
        this.isSuccess = isSuccess;
        this.portOccupied = portOccupied;
        this.errMessage = errMessage;
    }

    public PortCheckResult(boolean isSuccess, boolean portOccupied) {
        this.isSuccess = isSuccess;
        this.portOccupied = portOccupied;
        if (portOccupied) {
            this.errMessage = "端口已经被占用";
        }
    }
}
